<?php

/** Zend_View_Helper_Abstract.php */
require_once 'Zend/View/Helper/Abstract.php';

class Project_View_Helper_ProjectUrl extends Zend_View_Helper_Abstract
{
    /**
     * Generates an url given the name of a route.
     *
     * @access public
     *
     * @param  array $urlOptions Options passed to the assemble method of the Route object.
     * @param  mixed $name The name of a Route to use. If null it will use the current Route
     * @return string Url for the link href attribute.
     */
    public function projectUrl(array $urlOptions = array(), $name = null, $encode = true, $reset = true)
    {
        $router = Zend_Controller_Front::getInstance()->getRouter();
        $request = Zend_Controller_Front::getInstance()->getRequest();
        
        $requests = $request->getParams();
        if (!isset($urlOptions['module'])) {
            $urlOptions['module'] = $requests['module'];
        }
        if (!isset($urlOptions['controller'])) {
            $urlOptions['controller'] = $requests['controller'];
        }
        if (!isset($urlOptions['action'])) {
            $urlOptions['action'] = $requests['action'];
        }

        $url = $router->assemble($urlOptions, $name, $reset, $encode);
        return $url;
    }
}